package query.model;

/**
 * The Class that represent a word and its information in a query.
 */
public class QueryWord
{
  /** The position. */
  private int position;
  
  /** The word. */
  private String word;

  /** The weight. */
  private double weight;

  /**
   * Instantiates a new query word.
   *
   * @param position the position
   * @param word the word
   * @param weight the poids
   */
  public QueryWord(int position, String word, double weight)
  {
    this.position = position;
    this.word = word;
    this.weight = weight;
  }

  /**
   * Gets the position.
   *
   * @return the position
   */
  public int getPosition()
  {
    return position;
  }

  /**
   * Gets the word.
   *
   * @return the word
   */
  public String getWord()
  {
    return word;
  }

  /**
   * Gets the weight.
   *
   * @return the weight
   */
  public double getWeight()
  {
    return weight;
  }
  
  @Override
  public String toString()
  {
    return word;
  }
  
  @Override
  public boolean equals(Object obj)
  {
    return obj instanceof QueryWord && ((QueryWord) obj).getWord().equals(word);
  }
}
